package cn.service.service.impl;

import cn.service.entiy.Goods;
import cn.service.entiy.Order;
import cn.service.feign.GoodsFeign;
import cn.service.service.GoodsFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodsFeignServiceImpl implements GoodsFeignService {

    @Autowired
    private GoodsFeign goodsFeign;

    @Override
    public Boolean addGoods(Goods goods) {
        return goodsFeign.addGoods(goods);
    }

    @Override
    public Order getGoods(Order order) {
        Goods goods=goodsFeign.getGoodsById(order.getGoodsId());
        order.setGoodsName(goods.getName());
        order.setPrice(goods.getPrice());
        int sum=order.getQuality();
        Double price=goods.getPrice();
        Double summary=sum*price;
        order.setAmount(summary);
        return null;
    }
}
